<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);

String outPatientVisitInfoJson= (String)request.getAttribute("outPatientVisitInfoJson");
String success= (String)request.getAttribute("success");
%>
<link rel="stylesheet" href="${basePath}/assets/bootstrap/css/bootstrap.css"/>    
<link rel="stylesheet" href="${basePath}/assets/css/medical_record/home_page.css"/>
<link rel="stylesheet" href="${basePath}/assets/css/basic.css"/>
<link rel="stylesheet" href="${basePath}/assets/jquery-ui/jquery-ui.css"/>


<script type="text/javascript" src="${basePath}/assets/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/assets/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="${basePath}/assets/layer/layer.js"></script>

<script type="text/javascript" src="${basePath}assets/js/echarts.js"></script>




<input type="hidden" id="basePath" value="${basePath }">
<form action="${basePath}/report/edit_home_page_basic"
	method="post" id="basicDataForm">
<input type="hidden" id="month" name="month" value="${month}">

<table style="width:100%;" cellpadding="0" cellspacing="0" id="table">
<tbody>

	<td colspan="6" style="text-align:right;">
			<input type="button" value="导出" class="btn"  onclick="exportOutPatientVisitWord()">
			<input type="button" value="保存" class="btn"  onclick="saveOutPatientVisitInfo()">
	</td>
	
			<tr >
				 <td class="tdLabel_7" style="width:10%">
				   概述
				 </td>
				<td class="tdLabel_8" style="width:988px">
					<textarea style="width:97%;height:120px" >${outPatientVisitInfo.summary}</textarea>
				</td>
			</tr>
			
			<tr >
				 <td class="tdLabel_7" style="width:10%">
				   门急诊统计指标
				 </td>
				<td class="tdLabel_8" style="width:988px">
					<textarea style="width:97%;height:250px">${outPatientVisitInfo.outPatientVisitText}</textarea>
				</td>
			</tr>
			
			<tr >
				 <td class="tdLabel_7" style="width:10%">
				   说明
				 </td>
				<td class="tdLabel_8" style="width:988px">
					<textarea style="width:97%;height:120px" id="note">${outPatientVisitInfo.note}</textarea>
				</td>
			</tr>
			
			 <tr>
				 <td class="tdLabel_7">
				 	图(6)
				 </td>
				<td class="tdLabel_8" colspan="5">
						<div id="container" style="height:400px;width:100%"></div>
					
				</td>
			 </tr>
			 


			
		</tbody>
    </table>
   </form>





<script>

     var myChart;
     
     
      function exportOutPatientVisitWord(){
       var month = $("#month").val();
       var base64info = myChart.getDataURL();
       $.ajax({
          type:"post",
          data:{image:base64info,method:'getImage'},
          url:"${basePath}/report/exportOutPatientVisitWord",
          success:function(data){
               window.location.href ="${basePath}/report/exportOutPatientVisitWord?method=export&month="+month;
          }
       })
    
       // window.location.href ="${basePath}/report/exportCostFeeWord?month="+month;
    }


     //保存
     function saveOutPatientVisitInfo(){
	    var note = $("#note").val();
	    var base64info = myChart.getDataURL();
		$.ajax({
		    type:"post",
		    data:{note:note,outPatientVisitImageBase64:base64info},
		    url:"${basePath}/report/saveOutPatientVisitInfo",
		    success:function(data){
		    	layer.alert(data.msg,{icon:1});
		    }
		})

     }


    //生成门急诊指标文本信息

	
	
  
     
      //初始化图表信息
     $(function(){
		var outPatientVisitInfoJson= <%=outPatientVisitInfoJson%>;
		console.log(outPatientVisitInfoJson);
		if(null!=outPatientVisitInfoJson){
		   initCharSet(outPatientVisitInfoJson);
		}
		
     });
     


//格式化charset图表
function initCharSet(params){

var dom = document.getElementById("container");
myChart = echarts.init(dom);
var app = {};
option = null;
option = {
    legend: {
      y: 'bottom'
    },
    tooltip: {},
    dataset: {
        source: [
            ['product', params.monthList[0],  params.monthList[1],  params.monthList[2]],
            ['总诊疗人次数', params.totalConsulNumList[0], params.totalConsulNumList[1], params.totalConsulNumList[2]],
            ['门急诊人次数', params.outAndEmergNumList[0], params.outAndEmergNumList[1], params.outAndEmergNumList[2]],
            ['预约诊疗人次数', params.appointmentNumList[0], params.appointmentNumList[1], params.appointmentNumList[2]],
            ['普通门诊人次数', params.ordinaryOutNumList[0], params.ordinaryOutNumList[1], params.ordinaryOutNumList[2]]
        ]
    },
    xAxis: {type: 'category'},
    yAxis: {},
    series: [
        {type: 'bar'},
        {type: 'bar'},
        {type: 'bar'}
    ]
};
;
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
}
	
</script>